package com.walleipt.demo.ioc.factorBean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	
		/**
		 * alt+shift+l 生成名称
		 * shift+enter 换行
		 * 
		 */
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);
		
		String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
		for (String beanName : beanDefinitionNames) {
			System.err.println( beanName+"|"+applicationContext.getBeanFactory().getSingleton(beanName));			
		}
		
		BeanA bean = (BeanA) applicationContext.getBean("myFactoryBean");
		bean.print();
		
		
	}

}
